﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DTO;
using BUS;
namespace CungMuaC5.Account_Company
{
    public partial class ThongTinDN : System.Web.UI.Page
    {
        private DTO_TaiKhoan CurrentUser;
        private BUS_DoanhNghiep bus_DN = new BUS_DoanhNghiep();
        private BUS_LoaiKM bus_loaiKM = new BUS_LoaiKM();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                CurrentUser = Session.GetCurrentUser();
                int maTK = int.Parse(CurrentUser.MaTK.ToString());
                List<DTO_ChiTietDoanhNghiep> chitiet=bus_DN.LayChiTietDN(maTK);
                dvThongTinDN.DataSource = chitiet;                
                dvThongTinDN.DataBind();
                int loai;
                bool hasValue = int.TryParse(chitiet[0].LoaiHinhKinhDoanh,out loai);
                if (hasValue)
                {
                    string tenloai = bus_loaiKM.layTenLoai(loai);
                    Label lbl = (Label)dvThongTinDN.FooterRow.FindControl("lblLoaiHinhKD");
                    lbl.Text = tenloai;
                }
            }                        
        }
      
    }
}